package com.ruoyi.system.controller;

import java.lang.reflect.InvocationTargetException;
import java.math.BigDecimal;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletResponse;

import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.system.domain.*;
import com.ruoyi.system.domain.vo.OaOtherVo;
import com.ruoyi.system.domain.vo.OaProjectInitiationVo;
import com.ruoyi.system.domain.vo.OaProjectInitiationVoA;
import com.ruoyi.system.mapper.OaAccountsReceivableSummaryMapper;
import com.ruoyi.system.mapper.OaInvoiceApplicationMapper;
import com.ruoyi.system.service.*;
import org.springframework.beans.BeanUtils;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 记录项目立项的相关信息Controller
 *
 * @author ruoyi
 * @date 2025-03-10
 */
@RestController
@RequestMapping("/system/initiation")
@Transactional
public class OaProjectInitiationController extends BaseController {
    @Autowired
    private IOaProjectInitiationService oaProjectInitiationService;
    @Autowired
    private IOaOtherService oaOtherService;
    @Autowired
    private IOaCostExpenseListsService oaCostExpenseListsService;
    @Autowired
    private IOaOtheraPurchaseService oaOtheraPurchaseService;
    @Autowired
    private IOaSupplierPayableSummaryService oaSupplierPayableSummaryService;
    @Autowired
    private IOaPaySumService oaPaySumService;
    @Autowired
    private OaInvoiceApplicationMapper oaInvoiceApplicationMapper;
    @Autowired
    private OaAccountsReceivableSummaryMapper oaAccountsReceivableSummaryMapper;

    /**
     * 查询记录项目立项的相关信息列表
     */
    @PreAuthorize("@ss.hasPermi('system:initiation:list')")
    @GetMapping("/list")
    public TableDataInfo list(OaProjectInitiation oaProjectInitiation) {
        // 开始分页
        startPage();
        // 查询记录项目立项的相关信息列表
        List<OaProjectInitiation> list = oaProjectInitiationService.selectOaProjectInitiationList(oaProjectInitiation);
        // 返回分页数据
        return getDataTable(list);
    }

    /**
     * 导出记录项目立项的相关信息列表
     */
    @PreAuthorize("@ss.hasPermi('system:initiation:export')")
    @Log(title = "记录项目立项的相关信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, OaProjectInitiation oaProjectInitiation) {
        // 查询记录项目立项的相关信息列表
        List<OaProjectInitiation> list = oaProjectInitiationService.selectOaProjectInitiationList(oaProjectInitiation);
        // 导出Excel
        ExcelUtil<OaProjectInitiation> util = new ExcelUtil<OaProjectInitiation>(OaProjectInitiation.class);
        util.exportExcel(response, list, "记录项目立项的相关信息数据");
    }

    /**
     * 获取记录项目立项的相关信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:initiation:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Integer id) {
        // 根据id查询记录项目立项的相关信息
        return success(oaProjectInitiationService.selectOaProjectInitiationById(id));
    }

    /**
     * 新增记录项目立项的相关信息
     */
    @PreAuthorize("@ss.hasPermi('system:initiation:add')")
    @Log(title = "记录项目立项的相关信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody OaProjectInitiation oaProjectInitiation) {
        // 新增记录项目立项的相关信息
        return toAjax(oaProjectInitiationService.insertOaProjectInitiation(oaProjectInitiation));
    }

    /**
     * 修改记录项目立项的相关信息
     */
    @PreAuthorize("@ss.hasPermi('system:initiation:edit')")
    @Log(title = "记录项目立项的相关信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody OaProjectInitiation oaProjectInitiation) {
        // 修改记录项目立项的相关信息
        return toAjax(oaProjectInitiationService.updateOaProjectInitiation(oaProjectInitiation));
    }

    /**
     * 删除记录项目立项的相关信息
     */
    @PreAuthorize("@ss.hasPermi('system:initiation:remove')")
    @Log(title = "记录项目立项的相关信息", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Integer[] ids) {
        // 删除记录项目立项的相关信息
        int i = oaProjectInitiationService.deleteOaProjectInitiationByIds(ids);
        for (Integer id : ids) {
            oaOtherService.delete(id);
            oaOtheraPurchaseService.delete(id);
            oaSupplierPayableSummaryService.delete(id);
            oaPaySumService.delete(id);
            oaInvoiceApplicationMapper.delete(id);
            oaAccountsReceivableSummaryMapper.delete(id);

        }
        return toAjax(i);
    }

    //    // 删除指定id的记录
//    @PostMapping("/importExcel")
//    @Transactional
//    public AjaxResult importExcelData(@RequestParam("file") MultipartFile file) {
//        try (InputStream inputStream = file.getInputStream();
//             Workbook workbook = new XSSFWorkbook(inputStream)) {
//            Sheet sheet = workbook.getSheetAt(0);
//
//            for (int rowIndex = 3; rowIndex <= sheet.getPhysicalNumberOfRows(); rowIndex++) {
//                Row row = sheet.getRow(rowIndex);
//                if (row == null) continue;
//
//                OaProjectInitiation oaProjectInitiation = new OaProjectInitiation();
//
//                // 处理公司名称
//                Cell companyCell = row.getCell(0);
//                if (companyCell != null && companyCell.getCellType() == CellType.STRING) {
//                    oaProjectInitiation.setCompany(companyCell.getStringCellValue());
//                }
//
//                // 处理行业
//                Cell industryCell = row.getCell(1);
//                if (industryCell != null && industryCell.getCellType() == CellType.STRING) {
//                    oaProjectInitiation.setIndustry(industryCell.getStringCellValue());
//                }
//
//                // 处理二级公司
//                Cell secondaryCompanyCell = row.getCell(2);
//                if (secondaryCompanyCell != null && secondaryCompanyCell.getCellType() == CellType.STRING) {
//                    oaProjectInitiation.setSecondaryCompany(secondaryCompanyCell.getStringCellValue());
//                }
//
//                // 处理项目内容
//                Cell projectContentCell = row.getCell(3);
//                if (projectContentCell != null && projectContentCell.getCellType() == CellType.STRING) {
//                    oaProjectInitiation.setProjectContent(projectContentCell.getStringCellValue());
//                }
//
//                // 处理报价
//                Cell quotedPriceCell = row.getCell(4);
//                if (quotedPriceCell != null && quotedPriceCell.getCellType() == CellType.STRING) {
//                    try {
//                        BigDecimal bigDecimal = new BigDecimal(quotedPriceCell.getStringCellValue());
//                        oaProjectInitiation.setQuotedPrice(bigDecimal);
//                    } catch (NumberFormatException e) {
//                        // 处理数字格式异常
//                    }
//                }
//
//                // 处理开始日期
//                Cell commencementDateCell = row.getCell(5);
//                if (commencementDateCell != null && commencementDateCell.getCellType() == CellType.STRING) {
//                    try {
//                        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
//                        Date parse = dateFormat.parse(commencementDateCell.getStringCellValue());
//                        oaProjectInitiation.setCommencementDate(parse);
//                    } catch (ParseException e) {
//                        // 处理日期解析异常
//                    }
//                }
//
//                // 处理完成日期
//                Cell completionDateCell = row.getCell(6);
//                if (completionDateCell != null && completionDateCell.getCellType() == CellType.STRING) {
//                    try {
//                        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
//                        Date parse = dateFormat.parse(completionDateCell.getStringCellValue());
//                        oaProjectInitiation.setCompletionDate(parse);
//                    } catch (ParseException e) {
//                        // 处理日期解析异常
//                    }
//                }
//
//                // 处理甲方联系人
//                Cell partyAContactCell = row.getCell(7);
//                if (partyAContactCell != null && partyAContactCell.getCellType() == CellType.STRING) {
//                    oaProjectInitiation.setPartyAContact(partyAContactCell.getStringCellValue());
//                }
//                // 批量插入数据
//                oaProjectInitiationService.insertOaProjectInitiation(oaProjectInitiation);
//            }
//
//
//            return AjaxResult.success("插入数据成功");
//        } catch (IOException e) {
//            return AjaxResult.error("文件读取失败：" + e.getMessage());
//        }
//    }
//    @GetMapping("/carbonCopy")
//    //发送李辊刘昕抄送（行政财务一个部门）
//    public AjaxResult carbonCopy(Integer id) {
//        OaProjectInitiation oaProjectInitiation = oaProjectInitiationService.selectOaProjectInitiationById(id);
//        oaProjectInitiation.setReservedField2("1");
//        oaProjectInitiationService.updateOaProjectInitiation(oaProjectInitiation);
//        return AjaxResult.success("发送抄送成功");
//    }
    //发送李辊刘昕抄送数据
    @GetMapping("/carbonCopylist")
    public TableDataInfo carbonCopylist(OaProjectInitiation oaProjectInitiation) {
        // 查询记录项目立项的相关信息列表
        List<OaProjectInitiation> list = oaProjectInitiationService.selectOaProjectInitiationList1(oaProjectInitiation);
        // 返回分页数据
        return getDataTable(list);
    }

    //李锟
    @GetMapping("/quotationApproval")
    //发送行政管理抄送（行政财务一个部门）
    public AjaxResult quotationApproval(Integer id, String managementApproval) {
        //判断审批结果
        if (managementApproval.equals("同意")) {
            //根据id查询项目立项信息
            OaProjectInitiation oaProjectInitiation = oaProjectInitiationService.selectOaProjectInitiationById(id);
            //设置审批状态为已审批
            oaProjectInitiation.setManagementApproval("已审批");
            //更新项目立项信息
            oaProjectInitiationService.updateOaProjectInitiation(oaProjectInitiation);
        } else {
            //根据id查询项目立项信息
            OaProjectInitiation oaProjectInitiation = oaProjectInitiationService.selectOaProjectInitiationById(id);
            //设置审批状态为未通过
            oaProjectInitiation.setManagementApproval("已驳回");
            //更新项目立项信息
            oaProjectInitiationService.updateOaProjectInitiation(oaProjectInitiation);
        }

        //返回审批结果
        return AjaxResult.success("审批完毕");
    }

    //刘昕
    @GetMapping("/quotationApprovalA")
    //发送行政管理抄送（行政财务一个部门）
    public AjaxResult quotationApprovalA(Integer id, String managementApproval) {
        //判断审批结果
        if (managementApproval.equals("同意")) {
            //根据id查询项目立项信息
            OaProjectInitiation oaProjectInitiation = oaProjectInitiationService.selectOaProjectInitiationById(id);
            //设置审批状态为已审批
            oaProjectInitiation.setManagementApprovala("已审批");
            //更新项目立项信息
            oaProjectInitiationService.updateOaProjectInitiation(oaProjectInitiation);
        } else {
            //根据id查询项目立项信息
            OaProjectInitiation oaProjectInitiation = oaProjectInitiationService.selectOaProjectInitiationById(id);
            //设置审批状态为未通过
            oaProjectInitiation.setManagementApprovala("已驳回");
            //更新项目立项信息
            oaProjectInitiationService.updateOaProjectInitiation(oaProjectInitiation);
        }

        //返回审批结果
        return AjaxResult.success("审批完毕");
    }

    @GetMapping("/projectInitiationDetails")
//展示立项详情
    public AjaxResult projectInitiationDetails(String id) {
        //创建OaProjectInitiationVo对象
        OaProjectInitiationVo oaProjectInitiationVo = new OaProjectInitiationVo();
        //根据id查询立项信息
        OaProjectInitiation oaProjectInitiation = oaProjectInitiationService.selectOaProjectInitiationById(Integer.valueOf(id));
        //创建OaOther对象
        OaOther oaOther = new OaOther();
        //设置立项id
        oaOther.setInitiationId(id);
        //查询其他信息
        List<OaOther> oaOthers = oaOtherService.selectOaOtherList(oaOther);
        //将立项信息和其他信息设置到OaProjectInitiationVo对象中
        oaProjectInitiationVo.setOaProjectInitiation(oaProjectInitiation);
        //创建OaCostExpenseLists对象
        OaCostExpenseLists oaCostExpenseLists = new OaCostExpenseLists();
        //设置立项id
        oaCostExpenseLists.setInitationIds(id);
        //查询费用信息
        List<OaCostExpenseLists> oaCostExpenseLists1 = oaCostExpenseListsService.selectOaCostExpenseListsList(oaCostExpenseLists);
        //将费用信息设置到OaProjectInitiationVo对象中
        oaProjectInitiationVo.setOaCostExpenseLists(oaCostExpenseLists1);
        OaOtheraPurchase oaOtheraPurchase = new OaOtheraPurchase();
        oaOtheraPurchase.setInitiationId(id);
        List<OaOtheraPurchase> oaOtheraPurchases = oaOtheraPurchaseService.selectOaOtheraPurchaseList(oaOtheraPurchase);

        // 1. 将 oaOthers 转换为 OaOtherVo 列表
        List<OaOtherVo> otherVoList = oaOthers.stream()
                .map(other -> {
                    OaOtherVo vo = new OaOtherVo();
                    BeanUtils.copyProperties(other, vo); // 复制 OaOther 属性
                    vo.setOaOtheraPurchases(new ArrayList<>()); // 初始化空 purchase 列表
                    return vo;
                })
                .collect(Collectors.toList());

        // 2. 遍历 oaOtheraPurchases 匹配并填充 purchase 列表
        for (OaOtheraPurchase purchase : oaOtheraPurchases) {
            String purchaseSupplier = purchase.getPurchaseTableSequence(); // 按原逻辑使用 purchaseTableSequence
            for (OaOtherVo vo : otherVoList) {
                Long id1 = vo.getId();
                Long oaOtherId = purchase.getOaOtherId();
                if (id1.equals(oaOtherId)) {
                    //这种情况才存进oaProjectInitiationVo
                    if (vo.getType().equals(purchase.getType()) && vo.getSupplier().equals(purchaseSupplier)) {
                        vo.getOaOtheraPurchases().add(purchase); // 追加匹配的 purchase
                    }
                }

            }
        }

        oaProjectInitiationVo.setOaOtherVo(otherVoList);
        //返回成功信息
        return AjaxResult.success("发送抄送成功", oaProjectInitiationVo);
    }

    @GetMapping("/loginUser")
    //获取当前登录人信息
    public AjaxResult loginUser() {
        //获取当前登录用户信息
        LoginUser loginUser = SecurityUtils.getLoginUser();
        //返回当前登录用户信息
        return AjaxResult.success("当前登录人信息", loginUser);
    }

    @GetMapping("/managementApprovals")
    //李棍审批白色
    public AjaxResult managementApprovals(Integer id, String managementApproval) {
        OaProjectInitiation oaProjectInitiation = oaProjectInitiationService.selectOaProjectInitiationById(id);
        //判断审批结果
        if (managementApproval.equals("同意")) {
            //设置审批状态为已审批
            oaProjectInitiation.setManagementApprovals("已审批");
            //更新项目立项信息
            oaProjectInitiationService.updateOaProjectInitiation(oaProjectInitiation);
        } else {
            //设置审批状态为未通过
            oaProjectInitiation.setManagementApprovals("已驳回");
            //更新项目立项信息
            oaProjectInitiationService.updateOaProjectInitiation(oaProjectInitiation);
        }

        //返回审批结果
        return AjaxResult.success("审批完毕");
    }

    @GetMapping("/managementApprovalas")
    //刘昕审批白色
    public AjaxResult managementApprovalas(Integer id, String managementApproval) {
        OaProjectInitiation oaProjectInitiation = oaProjectInitiationService.selectOaProjectInitiationById(id);
        //判断审批结果
        if (managementApproval.equals("同意")) {
            //设置审批状态为已审批
            oaProjectInitiation.setManagementApprovalas("已审批");
            //更新项目立项信息
            oaProjectInitiationService.updateOaProjectInitiation(oaProjectInitiation);
        } else {
            //设置审批状态为未通过
            oaProjectInitiation.setManagementApprovalas("已驳回");
            //更新项目立项信息
            oaProjectInitiationService.updateOaProjectInitiation(oaProjectInitiation);
        }

        //返回审批结果
        return AjaxResult.success("审批完毕");
    }

    //负责人增项审批页面数据
    @GetMapping("/charge")
    public TableDataInfo charge(OaProjectInitiationVoA oaProjectInitiation) {
        // 获取当前登录用户信息并设置负责人
        LoginUser loginUser = SecurityUtils.getLoginUser();
        oaProjectInitiation.setInitiationPersonInCharge(loginUser.getUsername());
        // 查询已增项的采购记录
        OaOtheraPurchase queryCondition = new OaOtheraPurchase();
        queryCondition.setIsAdditionalItem(1);
        List<OaOtheraPurchase> additionalPurchases = oaOtheraPurchaseService.selectOaOtheraPurchaseList(queryCondition);

        // 提取立项 ID 并去重
        Set<String> initiationIdSet = new HashSet<>();
        for (OaOtheraPurchase purchase : additionalPurchases) {
            if (purchase.getInitiationId() != null) {
                initiationIdSet.add(purchase.getInitiationId());
            }
        }

        // 将去重后的立项 ID 转换为列表
        List<String> initiationIdList = new ArrayList<>(initiationIdSet);
        oaProjectInitiation.setIdlist(initiationIdList);
        if (initiationIdList.isEmpty()) {
            List<OaProjectInitiation> oaProjectInitiations = new ArrayList<>();
            return getDataTable(oaProjectInitiations);
        }
        // 开始分页
        startPage();

        // 查询记录项目立项的相关信息列表
        List<OaProjectInitiation> projectInitiationList = oaProjectInitiationService.selectOaProjectInitiationList2(oaProjectInitiation);

        // 返回分页数据
        return getDataTable(projectInitiationList);
    }

    //按钮项目是否完成 高琪
    @GetMapping("/complete")
    public AjaxResult complete(String id, String ok) {
        //根据id查询立项信息
        OaProjectInitiation oaProjectInitiation = oaProjectInitiationService.selectOaProjectInitiationById(Integer.valueOf(id));
        if (ok.equals("完成")) {
            oaProjectInitiation.setComplete(1);
            oaProjectInitiation.setCompleteDate(new Date());
            oaProjectInitiationService.updateOaProjectInitiation(oaProjectInitiation);
            OaSupplierPayableSummary oaSupplierPayableSummary = new OaSupplierPayableSummary();
            oaSupplierPayableSummary.setInitiationId(Long.valueOf(id));
            List<OaSupplierPayableSummary> oaSupplierPayableSummaries = oaSupplierPayableSummaryService.selectOaSupplierPayableSummaryList(oaSupplierPayableSummary);
            for (OaSupplierPayableSummary summary : oaSupplierPayableSummaries) {
                summary.setIsProjectCompleted("已完结");
                summary.setIsAmountSettled("已结清");
                oaSupplierPayableSummaryService.updateOaSupplierPayableSummary(summary);
            }
            return AjaxResult.success("项目已完成");
        } else {
            oaProjectInitiation.setComplete(0);
            oaProjectInitiationService.updateOaProjectInitiation(oaProjectInitiation);
            return AjaxResult.success("项目未完成");
        }
    }

    //发票审批页面数据
    @GetMapping("/invoice")
    public TableDataInfo invoice(OaProjectInitiationVoA oaProjectInitiation) {

        // 查询已增项的采购记录
        OaOtheraPurchase queryCondition = new OaOtheraPurchase();
        queryCondition.setInvoiceReview("0");
        List<OaOtheraPurchase> additionalPurchases = oaOtheraPurchaseService.selectOaOtheraPurchaseList(queryCondition);

        // 提取立项 ID 并去重
        Set<String> initiationIdSet = new HashSet<>();
        for (OaOtheraPurchase purchase : additionalPurchases) {
            if (purchase.getInitiationId() != null) {
                initiationIdSet.add(purchase.getInitiationId());
            }
        }

        // 将去重后的立项 ID 转换为列表
        List<String> initiationIdList = new ArrayList<>(initiationIdSet);
        oaProjectInitiation.setIdlist(initiationIdList);
        if (initiationIdList.isEmpty()) {
            List<OaProjectInitiation> oaProjectInitiations = new ArrayList<>();
            return getDataTable(oaProjectInitiations);
        }
        // 开始分页
        startPage();

        // 查询记录项目立项的相关信息列表
        List<OaProjectInitiation> projectInitiationList = oaProjectInitiationService.selectOaProjectInitiationList2(oaProjectInitiation);

        // 返回分页数据
        return getDataTable(projectInitiationList);
    }

    //增项审核按钮
    @GetMapping("/addendum")
    public AjaxResult addendum(String id, String ok) {
        OaOtheraPurchase oaOtheraPurchase = new OaOtheraPurchase();
        oaOtheraPurchase.setInitiationId(id);
        oaOtheraPurchase.setIsAdditionalItem(1);
        List<OaOtheraPurchase> oaOtheraPurchases = oaOtheraPurchaseService.selectOaOtheraPurchaseList(oaOtheraPurchase);
        if (ok.equals("通过")) {
            OaProjectInitiation oaProjectInitiation = oaProjectInitiationService.selectOaProjectInitiationById(Integer.valueOf(id));
            oaProjectInitiation.setFinancialApproval("已审批");
            oaProjectInitiationService.updateOaProjectInitiation(oaProjectInitiation);
            for (OaOtheraPurchase purchase : oaOtheraPurchases) {
                purchase.setIsAdditionalItem(2);
                oaOtheraPurchaseService.updateOaOtheraPurchase(purchase);
            }
            return AjaxResult.success("审核通过");
        } else {
            OaProjectInitiation oaProjectInitiation = oaProjectInitiationService.selectOaProjectInitiationById(Integer.valueOf(id));
            oaProjectInitiation.setFinancialApproval("未通过");
            //更新项目立项信息
            oaProjectInitiationService.updateOaProjectInitiation(oaProjectInitiation);
            return AjaxResult.success("审核不通过");
        }
    }

    //发票审核按钮
    @GetMapping("/invoiceVetting")
    public AjaxResult invoiceVetting(String id, String ok) {
        if (id != null || ok != null) {
            return AjaxResult.success("接口停用");
        }
        OaOtheraPurchase oaOtheraPurchase = new OaOtheraPurchase();
        oaOtheraPurchase.setInitiationId(id);
        oaOtheraPurchase.setInvoiceReview("0");
        List<OaOtheraPurchase> oaOtheraPurchases = oaOtheraPurchaseService.selectOaOtheraPurchaseList(oaOtheraPurchase);
        if (ok.equals("通过")) {
            for (OaOtheraPurchase purchase : oaOtheraPurchases) {
                purchase.setInvoiceReview("1");
                purchase.setInvoiceReviewdate(new Date());
                oaOtheraPurchaseService.updateOaOtheraPurchase(purchase);
            }
            return AjaxResult.success("审核通过");
        } else {
            return AjaxResult.success("审核不通过");
        }
    }

    //设置合同金额按钮
    @GetMapping("/contractAmount")
    public AjaxResult contractAmount(BigDecimal bigDecimal, Integer id) {

        OaProjectInitiation oaProjectInitiation = oaProjectInitiationService.selectOaProjectInitiationById(id);
        if (oaProjectInitiation == null) {
            return AjaxResult.error("立项不存在");
        }
        if (bigDecimal == null) {
            return AjaxResult.error("合同金额不能为空");
        }
        oaProjectInitiation.setContractAmount(bigDecimal);
        int i = oaProjectInitiationService.updateOaProjectInitiation(oaProjectInitiation);
        if (i > 0) {
            return AjaxResult.success("设置合同金额成功");
        } else {
            return AjaxResult.error("设置合同金额失败");
        }
    }

}
